
/*
 * @Description: 定时任务 - 接口
 * @Author: DSY
 * @Date: 2022-03-19 22:45:22
 * @LastEditors: DSY
 * @LastEditTime: 2022-03-19 22:45:22
 */

import { $get, $post, $put } from '/@/utils/http'
import { ContentTypeEnum } from '/@/constant/http'
import {
  QuartzJobModel,
  QuartzJobPageParams,
  QuartzJobPageResultModel,
  QuartzJobResultModel
} from './model/quartzJobModel'

/**
 * 分页查询
 */
export const apiQuartzJobSearch = (searchParams: QuartzJobPageParams) =>
  $get<QuartzJobPageResultModel>({
    url: '/quartz/twbQuartzJob/search',
    params: searchParams
  })

/**
 * 根据ID获取详情
 */
export const apiQuartzJobGetById = (id: string) =>
  $get<QuartzJobResultModel>({
    url: '/quartz/twbQuartzJob/getById',
    params: { id: id }
  })

/**
 * 保存信息
 */
export const apiQuartzJobSave = (saveParams: QuartzJobModel) =>
  $post<QuartzJobResultModel>({
    url: '/quartz/twbQuartzJob/save',
    contentType: ContentTypeEnum.json,
    params: saveParams
  })

/**
 * 更新信息
 */
export const apiQuartzJobUpdateById = (updateParams: QuartzJobModel) =>
  $put<QuartzJobResultModel>({
    url: '/quartz/twbQuartzJob/updateById',
    contentType: ContentTypeEnum.json,
    params: updateParams
  })

/**
 * 根据ID删除信息
 */
export const apiQuartzJobDeleteById = (id: string) =>
  $post<QuartzJobResultModel>({
    url: '/quartz/twbQuartzJob/deleteById',
    params: { id: id }
  })

/**
 * 批量删除信息
 */
export const apiQuartzJobBatchDeleteByIds = (ids: string) =>
  $post<QuartzJobResultModel>({
    url: '/quartz/twbQuartzJob/batchDeleteByIds',
    params: { ids: ids }
  })
/**
 * 立即执行一次
 */
export const apiQuartzJobRunOnceJobById = (id: string) =>
    $post<QuartzJobResultModel>({
        url: '/quartz/twbQuartzJob/runOnceJob',
        params: { id: id }
    })

/**
 * 立即执行一次
 */
export const apiChangeStatus = (id: string, status: string) =>
    $post<QuartzJobResultModel>({
        url: '/quartz/twbQuartzJob/changeStatus',
        params: { id: id,status: status }
    })
